<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${photo.id}"  type="hidden">

							<div class="form-group">
								<label class="col-sm-3 control-label">标题：</label>
								<div class="col-sm-8">
									<input id="title" name="title" th:value="${photo.title}" class="form-control" type="text">
								</div>
							</div>
														<div class="form-group">
															<label class="col-sm-3 control-label">描述：</label>
								<div class="col-sm-8">
									<input id="description" name="description" th:value="${photo.description}" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">照片：</label>
								<div class="col-sm-8">
									<input id="url" name="url" class="form-control" type="hidden" th:value="${photo.url}">
									<button type="button" class="layui-btn" id="photo">
										<i class="fa fa-cloud"></i>上传文件
									</button>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">&nbsp;</label>
								<div class="col-sm-8">
									<img id="photoSrc" width="200" height="200" th:src="${photo.url}"/>
								</div>
							</div>
																					<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<script src="/js/layui.js"></script>

	<script src="/js/plugins/layer/layer.min.js"></script>
	<script type="text/javascript" src="/js/appjs/system/photo/edit.js">
	</script>
</body>
</html>
<script type="text/javascript">

    layui.use('upload', function () {
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#photo', //绑定元素
            url: '/common/sysFile/upload', //上传接口
            size: 1000,
            accept: 'file',
            done: function (r) {
                layer.msg(r.msg);
                $("#url").val(r.fileName);
                $("#photoSrc").attr("src",r.fileName);
            },
            error: function (r) {
                layer.msg(r.msg);
            }
        });
    });

    // function changeType(i) {
    //     app.type = i;
    //     app.offset = 0;
    //     app.getData();
    // }
</script>
